package derbyclnt;

import java.util.List;


import com.sun.javafx.runtime.sequence.Sequence;

import derbyclnt.inter.ICar;
import derbyclnt.inter.IEngine;
import derbyclnt.sockets.SocketManager;

public class MainManager {
	
	private SocketManager _socketManager = new SocketManager();
	
	private int _clientId  = -1;
	private IEngine _engine;
	private ICar _car;
	private Sequence<? extends ICar> _otherCars;
	
	public int getClientId() { 
		assert _car == null || _car.getClientId() == _clientId;
		return _clientId;  
	}
	public void setClientId(int clientId) {
		_clientId = clientId;
		assert getCar() != null; 
		getCar().setClientId(clientId);
	}
	
	public IEngine getEngine() {
		assert _engine != null; 
		return _engine; 
	}
	public void setEngine(IEngine engine) {
		assert engine != null;
		_engine = engine; 
	}
	
	public ICar getCar() { return _car; }
	public void setCar(ICar car_) { 
		assert car_ != null; _car = car_; 
	}
	
	public Sequence<? extends ICar> getOtherCars() { return _otherCars; }
	public void setOtherCars(Sequence<? extends ICar> otherCars_) { assert otherCars_ != null; _otherCars = otherCars_; }
	
	public SocketManager getSocketManager() {
		return _socketManager;
	}

	public void start() throws Exception {
		_socketManager.start();
		//TODO 
	}
}
